package com.fengmi.cms.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fengmi.cms.entity.Content;
import com.fengmi.cms.service.IContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhuxm
 * @since 2022-03-02
 */
@RestController
@RequestMapping("/cms/content")
public class ContentController {


    @Autowired
    private IContentService contentService;

    /**
     * 根据内容分类id获取内容列表
     * @param catId 内容分类id
     * @return
     */
    @RequestMapping("findContentListByCatId/{catId}")
    public List<Content> findContentListByCatId(@PathVariable String catId){

        QueryWrapper<Content> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("category_id",catId);
       return contentService.list(queryWrapper);
    }

}
